package cn.coisini.model.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author xiangshaw
 * Description: 文章实体
 */
@Tag(name = "文章实体")
@Data
@TableName("tb_article")
public class Article implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "主键ID")
    @TableId("id")
    private String id;

    @Schema(description = "文章标题")
    @TableField("title")
    private String title;

    @Schema(description = "文章内容")
    @TableField("content")
    private String content;

    @Schema(description = "封面图像")
    @TableField("cover_img")
    private String coverImg;

    @Schema(description = "发布状态 0 草稿、1 已发布、2 删除")
    @TableField("state")
    private String state;

    @Schema(description = "文章分类名称ID")
    @TableField("category_id")
    private String categoryId;

    @Schema(description = "文章分类名称", hidden = false)
    @TableField(exist = false)
    private String categoryName;

    @Schema(description = "文章标签ID", hidden = false)
    @TableField(exist = false)
    private String tagId;

    @Schema(description = "文章标签", hidden = false)
    @TableField(exist = false)
    private List<String> tagName;

    @Schema(description = "文章标签颜色", hidden = false)
    @TableField(exist = false)
    private String tagColor;

    @Schema(description = "创建者ID")
    @TableField("create_user")
    private String createUser;

    @Schema(description = "创建时间")
    @TableField("create_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @TableField("update_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime updateTime;
}
